﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:sysglobal="clr-namespace:System.Globalization;assembly=mscorlib"
    xmlns:ig="clr-namespace:Infragistics.Windows.Editors;assembly=InfragisticsWPF4.Editors.v10.3"
    xmlns:local="clr-namespace:OMANE.Common.UI.Theme"
    xmlns:igWindows="http://infragistics.com/Windows"
    mc:Ignorable="d" >

    <ResourceDictionary.MergedDictionaries>
    	<ResourceDictionary Source="OMANE_Brushes.xaml" />
        <ResourceDictionary Source="OMANE_Base.xaml" />
    </ResourceDictionary.MergedDictionaries>
	
    <ControlTemplate x:Key="NumericEditorControlTemplate" TargetType="{x:Type ig:XamNumericEditor}">
    	<Border x:Name="MainBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="5">
    		<DockPanel>
    			<Grid x:Name="PART_SpinButtons" Width="40" DockPanel.Dock="Right" Margin="0,1" Visibility="{TemplateBinding SpinButtonVisibilityResolved}"/>
                <igWindows:SimpleTextBlock xml:lang="fr-FR"  x:Name="TextBlock" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Text="{TemplateBinding DisplayText}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
    		</DockPanel>
    	</Border>
		<ControlTemplate.Triggers>
			<Trigger Property="IsEmbedded" Value="False">
				<Setter Property="Padding" Value="4,2"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>
    
    <!-- PercentageEditor -->
	<Style  x:Key="PercentageEditor" BasedOn="{StaticResource controlOMANE}" TargetType="{x:Type ig:XamNumericEditor}">
		<Setter Property="Background" Value="{DynamicResource DefaultBackgroundBrush}"/>
		<Setter Property="BorderBrush" Value="{DynamicResource BrushCouleur2Base}"/>
		<Setter Property="Padding" Value="1"/>
		<Setter Property="HorizontalContentAlignment" Value="Left"/>
		<Setter Property="VerticalContentAlignment" Value="Center"/>
		<Setter Property="Width" Value="150"/>
		<Setter Property="HorizontalAlignment" Value="Left"/>
		<Setter Property="Margin" Value="5,1,1,1"/>
		<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
        <Setter Property="RenderTransform">
			<Setter.Value>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform/>
					<RotateTransform/>
					<TranslateTransform/>
				</TransformGroup>
			</Setter.Value>
		</Setter>
		<Setter Property="Value">
			<Setter.Value>
				<sys:Double>0.113678788</sys:Double>
			</Setter.Value>
		</Setter>
		<Setter Property="PromptChar" Value=""/>
		<Setter Property="Cursor" Value="Pen"/>
		<Setter Property="OverridesDefaultStyle" Value="False"/>
		<Setter Property="Template" Value="{DynamicResource NumericEditorControlTemplate}"/>
		<Setter Property="Format" Value="0.00%"/>
		<Setter Property="IsInEditMode" Value="False"/>
		<Setter Property="SpinButtonDisplayMode" Value="OnlyInEditMode"/>
		<Setter Property="DataMode" Value="Raw"/>
		<Setter Property="EditTemplate" Value="{DynamicResource PercentageEditorEditTemplate}"/>
		<Setter Property="ValueConstraint">
			<Setter.Value>
				<ig:ValueConstraint ValidateAsType="Double" Nullable="False" MinInclusive="0"/>
			</Setter.Value>
		</Setter>
        <Setter Property="InvalidValueBehavior" Value="RetainValue"/>
        <Setter Property="SpinIncrement" Value="0,01" />          
        
		<Style.Triggers>
			<Trigger Property="IsInEditMode" Value="True">
				<Setter Property="Background" Value="White"/>
				<Setter Property="BorderBrush" Value="{DynamicResource BrushCouleur1BckFonce}"/>
			</Trigger>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter Property="RenderTransform">
					<Setter.Value>
						<TransformGroup>
							<ScaleTransform ScaleX="1.1" ScaleY="1.1"/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Setter.Value>
				</Setter>
			</Trigger>
		</Style.Triggers>						
	</Style>

    <!-- AgeEditor -->
    <Style x:Key="AgeEditor" BasedOn="{StaticResource PercentageEditor}" TargetType="{x:Type ig:XamNumericEditor}">
        <Setter Property="SpinIncrement" Value="1"/>
        <Setter Property="Format" Value="0 ans"/>
        <Setter Property="ValueType" Value="{x:Type sys:Double}" />
        <Setter Property="ValueConstraint">
            <Setter.Value>
                <ig:ValueConstraint MaxInclusive="98" MinInclusive="18" Nullable="False" ValidateAsType="Double"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Value">
            <Setter.Value>
                <sys:Int32>68</sys:Int32>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DureeMoisEditor -->
    <Style x:Key="DureeMoisEditor" BasedOn="{StaticResource PercentageEditor}" TargetType="{x:Type ig:XamNumericEditor}">
        <Setter Property="SpinIncrement" Value="1"/>
        <Setter Property="Format" Value="0 mois"/>
        <Setter Property="ValueType" Value="{x:Type sys:Int32}" />
        <Setter Property="ValueConstraint">
            <Setter.Value>
                <ig:ValueConstraint MaxInclusive="1200" MinInclusive="1" Nullable="False" ValidateAsType="Integer32"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Value">
            <Setter.Value>
                <sys:Int32>68</sys:Int32>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- NumberEditor -->
    <Style x:Key="NumberEditor" BasedOn="{StaticResource PercentageEditor}" TargetType="{x:Type ig:XamNumericEditor}">
        <Setter Property="SpinIncrement" Value="1"/>
        <Setter Property="Format" Value="###,###"/>
        <Setter Property="ValueType" Value="{x:Type sys:Double}" />
        <Setter Property="ValueConstraint">
            <Setter.Value>
                <ig:ValueConstraint MinInclusive="1" Nullable="False" ValidateAsType="Double"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Value">
            <Setter.Value>
                <sys:Int32>1000</sys:Int32>
            </Setter.Value>
        </Setter>
    </Style>


    <!-- EurosEditor -->
    <Style x:Key="EurosEditor" BasedOn="{StaticResource PercentageEditor}" TargetType="{x:Type ig:XamNumericEditor}">
        <Setter Property="SpinIncrement" Value="1"/>
        <Setter Property="Format" Value="###,### €"/>
        <Setter Property="ValueType" Value="{x:Type sys:Double}" />
        <Setter Property="ValueConstraint">
            <Setter.Value>
                <ig:ValueConstraint MaxInclusive="1000000000" MinInclusive="1" Nullable="False" ValidateAsType="Double"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Value">
            <Setter.Value>
                <sys:Double>10000</sys:Double>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- SelMedicaleEditor -->
    <Style x:Key="SelMedicaleEditor" BasedOn="{StaticResource PercentageEditor}" TargetType="{x:Type ig:XamNumericEditor}">
        <Setter Property="SpinIncrement" Value="1"/>
        <Setter Property="Format" Value="0"/>
        <Setter Property="ValueType" Value="{x:Type sys:Int32}" />
        <Setter Property="ValueConstraint">
            <Setter.Value>
                <ig:ValueConstraint MinInclusive="1" Nullable="False" ValidateAsType="Integer32"/>
            </Setter.Value>
        </Setter>
        <Setter Property="Value">
            <Setter.Value>
                <sys:Int32>2</sys:Int32>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="PercentageEditorEditTemplate" TargetType="{x:Type ig:XamNumericEditor}">
    	<Border d:DesignWidth="231" d:DesignHeight="22.96" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="5">
    		<Grid Margin="5">
    			<Grid.ColumnDefinitions>
    				<ColumnDefinition Width="*"/>
    				<ColumnDefinition Width="Auto"/>
    			</Grid.ColumnDefinitions>
                <local:NumericTextbox  xml:lang="fr-FR"  IsTabStop="False" Text="{Binding Value, RelativeSource={RelativeSource TemplatedParent}}" Grid.ColumnSpan="1" BorderBrush="{x:Null}"/>
    			<UniformGrid Columns="2" Grid.Column="1"  >
    				<RepeatButton 
                        x:Name="moinsButton" IsTabStop="False"   
                        Margin="4,0,2,0" 
                        Width="{Binding ActualHeight, ElementName=moinsButton, Mode=OneWay}" 
                        Content="-" FontWeight="Bold" 
                        Background="{DynamicResource DefaultBackgroundBrush}" 
                        FontFamily="Stencil" 
                        FontSize="16" 
                        Padding="0" 
                        Focusable="False"
                        Command="{Binding MoinsButtonCommand, RelativeSource={RelativeSource TemplatedParent}}"/>
                    <RepeatButton 
                        x:Name="plusButton" 
                        IsTabStop="False" 
                        Margin="2,0,4,0" 
                        Width="{Binding ActualHeight, ElementName=plusButton, Mode=OneWay}" 
                        Content="+" 
                        FontWeight="Bold" 
                        Background="{DynamicResource DefaultBackgroundBrush}" 
                        FontFamily="Stencil" 
                        FontSize="16" 
                        Padding="0" 
                        Focusable="False" 
                        Command="{Binding PlusButtonCommand, RelativeSource={RelativeSource TemplatedParent}}">                        
                     
                    </RepeatButton>
                </UniformGrid>  	
    		</Grid>
    	</Border>        
    </ControlTemplate>
    
    
</ResourceDictionary>
